package com.ibeeking.found.upms.cs.rest.service.impl;

import com.ibeeking.found.upms.cs.rest.service.ICsUserRoleService;
import com.ibeeking.found.upms.service.common.bo.CsUserRoleBO;
import com.ibeeking.found.upms.service.common.dos.CsUserRoleDO;
import com.ibeeking.found.upms.service.mapper.CsUserRoleMapper;
import com.ibeeking.nematos.utils.json.JsonUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName CsUserRoleServiceImpl
 * @Description
 * @Author ibeeking
 * @Date 2021-05-13 11:39
 **/
@Service
public class CsUserRoleServiceImpl implements ICsUserRoleService {

    @Resource
    private CsUserRoleMapper csUserRoleMapper;

    @Override
    public List<CsUserRoleBO> queryUserRoleByUserIds(List<Long> userIds) {
        List<CsUserRoleDO> csUserRoleDos = csUserRoleMapper.selectList(new LambdaQueryWrapper<>(CsUserRoleDO.class)
                .in(CsUserRoleDO::getUserId, userIds)
        );
        return JsonUtils.jsonToList(csUserRoleDos, CsUserRoleBO.class);
    }
}
